package rmicomplex;

import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

public class Client implements ClientInterface
{
	private int lugar;
	public void refresh(int dato) throws RemoteException
	{
		lugar = dato;
		System.out.println(lugar);
	}
	
	public Client()
	{
		try
		{ // esto es lo mismo que haber extendido de UnicastRemoteObject
			UnicastRemoteObject.exportObject(this);
		}
		catch(Exception e)
		{
		}
		try
		{
			MasterInterface handle =
			(MasterInterface)Naming.lookup("//eiffel.itba.edu.ar:20005/aServ");
			handle.setClientInterface(this);
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}
	
	public static void main(String args[])
	{
		new Client();
	}
}